package com.turbo.listener;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.*;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.openapi.wm.ex.ToolWindowManagerListener;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * @author: zwx
 * @time: 2021/3/21 19:19
 * 监听文件的变化
 */
public class DirListener implements BulkFileListener {

    @Override
    public void after(@NotNull List<? extends VFileEvent> events) {
        for (VFileEvent event : events) {
            System.out.println(event.toString());
            if (event instanceof VFileCreateEvent){
                // create
            }
            if (event instanceof VFileContentChangeEvent){
                // update
            }
            if (event instanceof VFileDeleteEvent){
                // delete
            }
        }
    }
}
